import Cookies from 'js-cookie'

export default {
    set(key, value) {
        if (!key || !value) return
        Cookies.set(key, value)
    },
    get(key) {
        if (!key) return null
        return Cookies.get(key)
    },
    setJSON(key, jsonValue) {
        if (!key || !jsonValue) return
        this.set(key, JSON.stringify(jsonValue))
    },
    getJSON(key) {
        const value = this.get(key)
        return value ? JSON.parse(value) : null
    },
    remove(key) {
        if (!key) return
        Cookies.remove(key)
    }
}